﻿/*
 * Jonathan
 * Created by: Jonathan Montiverdi
 * Date: 7/31/2012
 * License: http://jonathan.codeplex.com/license
 */
using System;
using Monti.MVVM;

namespace Jonathan.Data
{
   /// <summary>
   /// Description of Download.
   /// </summary>
   public class Download : ViewModelBase
   {
      private int m_Progress;
      private bool m_IsCompleted;
      
      /// <summary>
      /// Event called when the download has completed.
      /// </summary>
      public event EventHandler Completed;
      
      /// <summary>
      /// Gets or Sets the server file name.
      /// </summary>
      public string ServerFile { get; set; }
      
      /// <summary>
      /// Gets or Sets the local file name.
      /// </summary>
      public string LocalFile { get; set; }
      
      /// <summary>
      /// Gets or Sets if the download was successful or not.
      /// </summary>
      public bool WasSuccessful { get; set; }
      
      /// <summary>
      /// Gets or Sets the download's progress.
      /// </summary>
      public int Progress
      {
         get { return this.m_Progress; }
         set
         {
            this.m_Progress = value;
            this.RaisePropertyChanged ("Progress");
         }
      }
      
      /// <summary>
      /// Gets or Sets if the download is completed or not.
      /// </summary>
      public bool IsCompleted
      {
         get { return this.m_IsCompleted; }
         set
         {
            this.m_IsCompleted = value;
            if (this.Completed != null)
               this.Completed (this, EventArgs.Empty);
            this.RaisePropertyChanged ("IsCompleted");
         }
      }
   }
}
